<?php
/*
 * @Author: your name
 * @Date: 2022-01-04 15:27:52
 * @LastEditTime: 2022-01-14 10:52:20
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /nlog/routes/dailyPartTime.php
 */

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\daily_partTime\User;                   //用户类
use App\Http\Controllers\daily_partTime\CustomerService;        //客服


/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::prefix('/user')->group(function () {
    Route::post('/wechatLogin', [User::class, 'userLoginWechat']);           //微信小程序登录
    Route::post('/toutiaoLogin', [User::class, 'userLoginToutiao']);         //头条小程序登录
    Route::post('/loginOut', [User::class, 'loginOut']);                     //退出登录
    Route::post('/checkToken', [User::class, 'checkToken']);                 //检查登录状态

});


Route::middleware('CheckPartTimeToken')->group(function () {                      //检查是否登录
    Route::prefix('/user')->group(function () {
        Route::post('/checkCustomer', [User::class, 'checkCustomer']);           //微信小程序登录
        Route::post('/getUserMessage', [User::class, 'getUserMessage']);         //查询客户信息

        //    Route::post('/onBind', [User::class, 'onBind']);                         //绑定
    });
    Route::prefix('/customerService')->group(function () {
        Route::post('/sendToCustomer',  [CustomerService::class, 'sendToCustomer']);                         //发送消息给客户
        Route::post('/sendToService',   [CustomerService::class, 'sendToService']);                          //发送消息给客服
        Route::post('/messageHistory',  [CustomerService::class, 'messageHistory']);                         //历史信息
        Route::post('/messageNotReadNumber',  [CustomerService::class, 'messageNotReadNumber']);             //未读消息多少条
        Route::post('/messageCustomerRead', [CustomerService::class, 'messageCustomerRead']);                //阅读所有消息
        Route::post('/messageReadOne', [CustomerService::class, 'messageReadOne']);                          //阅读单条消息
        Route::post('/messageServiceNotReadList', [CustomerService::class, 'messageServiceNotReadList']);    //客服未读列表
        Route::post('/messageServiceHistory', [CustomerService::class, 'messageServiceHistory']);            //客服历史记录
        Route::post('/messageServiceRead', [CustomerService::class, 'messageServiceRead']);                  //客服阅读
    });
});
